﻿@model PetaPoco.Page<Shop.Wares.Models.Wares>
@{
    //前台商品类别的主要商品信息
    Layout = null;
}

<div class="products-list row grid">
    @foreach (var item in Model.Items)
    {
        <div class="product-layout col-md-4 col-sm-6 col-xs-12 ">
            <div class="product-item-container">
                <div class="left-block">
                    <div class="product-image-container lazy second_img " style="width:100%;height:0px;padding-bottom:100%;position:relative;">
                        <img  src="@item.Url" alt="@item.WName" class="img-responsive" style=" width:100%;height:100%;position:absolute;" />
                        @*<img data-src="~/Content/Home/image/demo/shop/product/e12.jpg" src="" alt="商品名" class="img_0 img-responsive" />*@
                    </div>
                    <!--商品左上角的字-->
                    <span class="label label-sale">爆款</span>
                    <!--查看详情-->
                    <a class="quickview  visible-lg" data-fancybox-type="iframe" href="WaresProduct-@item.WID">查看详情</a>
                    <!--查看详情-->
                </div>

                <div class="right-block">
                    <div class="caption">
                        <h4><a href="product.html">@item.WName</a></h4>
                        <div class="price">
                            <span class="price-new">原价:@item.PPrice</span>
                            <span class="price-old">现价:@item.OPrice</span>
                            <span class="label label-percent">-@(Math.Round((item.OPrice - item.PPrice) / item.OPrice * 100, 1))%</span>
                        </div>
                        @*商品简介*@
                        <div class="description item-desc hidden">
                            <p>@item.Describe</p>
                        </div>
                    </div>

                    <div class="button-group">
                        <button class="addToCart" type="button" data-toggle="tooltip" title="加入购物车" onclick="addshopcar('@item.WID','@item.WName','@item.Url')"><i class="fa fa-shopping-cart"></i> <span class="hidden-xs">加入购物车</span></button>
                        <button class="wishlist" type="button" data-toggle="tooltip" title="Add to Wish List" onclick="wishlist.add('42');"><i class="fa fa-heart"></i></button>
                    </div>
                </div>
            </div>
        </div>
        <div class="clearfix visible-xs-block"></div>
    }
</div>					
@*底部页码*@
<div class="product-filter product-filter-bottom filters-panel">
    <div class="row">
        @*<div class="col-md-2 hidden-sm hidden-xs">
        </div>*@
        <div class="short-by-show text-center col-md-7 col-sm-5 col-xs-12">
            <div class="form-group" style="margin: 7px 10px">第@(Model.CurrentPage)页/共@(Model.TotalPages)页</div>
        </div>
        @*分页*@
        <div class="box-pagination col-md-4 col-sm-7">
            @if (Model.TotalPages <= 1)
            {
                <div class="btn-group" role="group" style="margin: 7px 10px">
                    <input type="button" class="btn btn-default disabled btn-sm" value="首页" onclick=""/>
                    <input type="button" class="btn btn-default disabled btn-sm" value="上一页" onclick="" />
                    <input type="button" class="btn btn-default disabled btn-sm" value="下一页" onclick="" />
                    <input type="button" class="btn btn-default disabled btn-sm" value="尾页" onclick="" />
                </div>
            }
            else if (Model.CurrentPage == 1 && Model.TotalPages != 1)
            {
                <div class="btn-group" role="group"  style="margin: 7px 10px">
                    <input type="button" class="btn btn-default disabled btn-sm" value="首页" onclick="" />
                    <input type="button" class="btn btn-default disabled btn-sm" value="上一页" onclick="" />
                    <input type="button" class="btn btn-default btn-sm" value="下一页" onclick="NextPage()" />
                    <input type="button" class="btn btn-default btn-sm" value="尾页" onclick="Shadowe()" />
                </div>
            }
            else if (Model.CurrentPage > 1 && Model.CurrentPage < Model.TotalPages)
            {
                <div class="btn-group" role="group"  style="margin: 7px 10px">
                    <input type="button" class="btn btn-default btn-sm" value="首页" onclick="HomePage()" />
                    <input type="button" class="btn btn-default btn-sm" value="上一页" onclick="PreviousPage()" />
                    <input type="button" class="btn btn-default btn-sm" value="下一页" onclick="NextPage()" />
                    <input type="button" class="btn btn-default btn-sm" value="尾页" onclick="Shadowe()" />
                </div>
            }
            else if (Model.CurrentPage == Model.TotalPages && Model.CurrentPage != 1)
            {
                <div class="btn-group" role="group"  style="margin: 7px 10px">
                    <input type="button" class="btn btn-default btn-sm" value="首页" onclick="HomePage()" />
                    <input type="button" class="btn btn-default btn-sm" value="上一页" onclick="PreviousPage()" />
                    <input type="button" class="btn btn-default disabled btn-sm" value="下一页" onclick="" />
                    <input type="button" class="btn btn-default disabled btn-sm" value="尾页" onclick="" />
                </div>
            }
           
        </div>

    </div>
</div>
<script type="text/javascript">
     //首页
    function HomePage() {
        JumpPage("1");
    }
    //下一页
    function NextPage()
    {
        JumpPage("@(Model.CurrentPage+1)");
    }
    //上一页
    function PreviousPage()
    {
        JumpPage("@(Model.CurrentPage-1)");
    }
    //尾页
    function Shadowe()
    {
        JumpPage("@(Model.TotalPages)");
    }
   
</script>